package com.china08.yxyapi.api.manage.sch.office.outernotice;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.china08.yxyapi.api.YxyApiBaseController;
import com.china08.yxyapi.repository.mg.YxyNoticeOutterRepository;

@CrossOrigin
@RestController
public class OuterNoticeReceiveNoReadCountController extends YxyApiBaseController {

    @Autowired
    YxyNoticeOutterRepository yxyNoticeOutterRepository;

    @RequestMapping(value = "/api_yw/manage/sch/office/outerNotice/receive/noReadCount", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public RespModel precess(HttpServletRequest request, HttpServletResponse response) {

        String edbId = getProfile(request, response).getSchoolId();
        // 当前用户的获取
        Integer count = yxyNoticeOutterRepository.countByEdbIdAndReceiveSchoolIsDelete(edbId, 0, 0);

        RespModel respModel = new RespModel();
        respModel.count = count;

        return respModel;
    }

    public static class RespModel {
        public Integer count;
    }
}
